import axios from '@/libs/axios1'
let jsonHeaders = {
  'content-type': 'application/json;charset=UTF-8'
}
let base ='/testplatform/product'
let baseUnit = '/testplatform/assetInstitution'
let baseVendor = '/testplatform/vendor'
let baseProductType = '/testplatform/productType'
let baseProductOwner = '/testplatform/productOwnership'
let baseNet = '/testplatform/testNetinfo'
let baseAsset = '/testplatform/asset'
let baseOrg = '/testplatform/org'
// 判断版本是否可删除
export const whetherDelVersion = productId => {
  return axios({
    url: `${base}/whetherDelVersion/${productId}`,
    method: 'GET',
    headers: jsonHeaders,
  })
}
export const queryProduct2 = params => {
  return axios({
    url: `${base}/getProductQueryV2`,
    method: 'GET',
    params,
    headers: jsonHeaders,
  })
}
export const queryProduct = params => {
  return axios({
    url: `${base}`,
    method: 'GET',
    params,
    headers: jsonHeaders,
  })
}
export const deleteProduct2 = data => {
  return axios({
    url: `${base}/delProductV2`,
    method: 'DELETE',
    data,
    headers: jsonHeaders,
  })
}
export const updateProduct = data => {
  return axios({
    url: `${base}`,
    method: 'PUT',
    headers: jsonHeaders,
    data
  })
}
export const updateProduct2 = data => {
  return axios({
    url: `${base}/updProductV2`,
    method: 'PUT',
    headers: jsonHeaders,
    data
  })
}
export const addProduct = data => {
  return axios({
    url: `${base}`,
    method: 'POST',
    headers: jsonHeaders,
    data
  })
}
export const getNameUsedV2 = params => {
  return axios({
    url: `${base}/getNameUsedV2`,
    method: 'GET',
    params,
    headers: jsonHeaders,
  })
}
// 查询产品单位列表
export const queryAssetInstitutionList = params => {
  return axios({
    url: `${baseProductOwner}/getPage`,
    method: 'GET',
    params,
    headers: jsonHeaders,
  })
}
// 查询网络列表
export const queryNetInstitutionList = params => {
  return axios({
    url: `${baseUnit}/getPage`,
    method: 'GET',
    params,
    headers: jsonHeaders,
  })
}
//查询供应商列表
export const queryVendor = params => {
  return axios({
    url: `${baseVendor}`,
    method: 'GET',
    params,
    headers: jsonHeaders,
  })
}
export const queryProductType = params => {
  return axios({
    url: `${baseProductType}/getTree`,
    method: 'GET',
    params,
    headers: jsonHeaders,
  })
}
export const addNewVersionV2 = data => {
  return axios({
    url: `${base}/addNewVersionV2`,
    method: 'POST',
    headers: jsonHeaders,
    data
  })
}
export const queryProductVersion = params => {
  return axios({
    url: `${base}/getProductVersionV2`,
    method: 'GET',
    params,
    headers: jsonHeaders,
  })
}
export const deleteProduct = id => {
  return axios({
    url: `${base}/${id}`,
    method: 'DELETE',
    headers: jsonHeaders,
  })
}
// 查询资产网络列表
export const queryAssetNetworkMeshList = params => {
  return axios({
    url: `${baseAsset}/network/mesh/page`,
    method: 'GET',
    params,
    headers: jsonHeaders,
  })
}
// 查询网络信息列表
export const queryNetworkInfoList = params => {
  return axios({
    url: `${baseNet}/page`,
    method: 'GET',
    params,
    headers: jsonHeaders,
  })
}
export const queryOrganization = params => {
  return axios({
    url: `${baseOrg}/getTree`,
    method: 'GET',
    params,
    headers: jsonHeaders,
  })
}


